package com.detroitchow;

import java.util.ArrayList;

import com.detroitchow.R;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.TextView;

public class TagArrayAdapter extends ArrayAdapter<String> {
	
	private final Activity myContext;
  private final ArrayList<String> tags;
  
  public TagArrayAdapter(Activity context, int textViewResourceId, int elementId, ArrayList<String> tags) {
    super(context, textViewResourceId, elementId, tags);
    this.myContext = context;
    this.tags = tags;
  }
  
  public View getView(int index, View convertView, ViewGroup parent){
    
    String tag = this.tags.get(index);
    View row = convertView;
    if(row==null){
      LayoutInflater inflater = myContext.getLayoutInflater();
      row = inflater.inflate( R.layout.linkitem, parent, false);
    }
    
    TextView txtTag = (TextView) row.findViewById(R.id.txtTag);
    txtTag.setText(tag);
    return row;
 }

}
